1. Field of the Invention
In general, the present invention relates to systems that utilize source code generators that automatically generate source code and alter programming depending upon the inputs of a system's user. More particularly, the present invention relates to systems with automatic source code generation that modify existing source code in order to produce modified applications or completely new application variants.
2. Prior Art Description
A source code generator may be defined as a system for automating the source code construction for all or part of a software application. The source code generator is controlled from a user interface or input file, from which syntactically correct high-level source code (for example C++, C#, Java, Python, Ruby, Perl, etc.) is automatically created. The created source code can be compiled or interpreted by the appropriate computerized system and subsequently executed. Source code generators close the gap between the input design world and the final output executable-code world and are generally used in practice to minimize repetitive coding tasks and to minimize or eliminate the number of human-generated source code lines being created. In simplistic terms, a source code generator reads from the input and then uses a set of templates to produce output source code. Thus, a source code generator specifies how information is extracted from the input and transformed into source code.
The use of automated source code generation has many benefits over having a programmer write custom code. By using automated source code generation, a programmer need not focus on the writing and debugging of lines of code. Rather, a programmer can focus on the overall design and methodology of the software, thereby eliminating many abstraction problems. Furthermore, by using automated source code generation, there is a significant improvement in the consistency and quality of the code that is generated. Lower error rates can be achieved as many common coding problems can be guaranteed not to occur. Additionally, automated source code generation takes a fraction of the time to produce as compared to manual development of the equivalent amount of code. Accordingly, there are significant development labor savings due to the abstraction, consistency and quality benefits.
Existing art source Code generators may generally be divided into two types. Those types are code-driven source code generators and model driven source code generators.
A typical code-driven source code generator takes, as input, either existing source code or source code with additions in a defined mark-up language. A mark-up language is one which can be added to text files to transform the text itself or the way in which the text should appear. HTML, which is used to describe web content, is a common example of a mark-up language. Code-driven source code generators are typically used to help with the software development process via the generation of partial sections of new code or meta-data for maintenance purposes.
The advantages of code-driven source code generators are that they can be used with pre-existing source code bases. Furthermore, the operation is fairly straight forward and can be readily understood by software developers. This can yield advantages in terms of speed of development and easier maintenance.
One disadvantage of code-driven source code generators is that the input is generally platform specific. Consequently, a code-driven source code generator is typically limited to software developers with knowledge of the existing source code. This is typically because the input has implementation code mixed up with specification design information, thus providing low levels of abstraction. With active generation, the generator implemented code is generally mixed back with the input design thus providing even lower levels of abstraction. This makes it impractical for use in generating complete applications.
Prior art code-driven source code generators are exemplified by U.S. Pat. No. 5,875,333 to Fish, entitled Automatically Generating Source Code For Relating A Dialog Interface With A Business Object In A Computing Application, and U.S. Patent Application Publication No. 2002/0178434 to Fox, entitled Apparatus And Method For Automatic Source Code Generation In A Process Control Environment.
Model-driven source code generators, sometimes called declarative source code generators, do not use source code as its initial input. Rather, a model-driven source code generator uses an abstract design as input which specifies (declares) what the application is required to do. Using templates, a code database or the like, it is left to the source code generator to determine the implementation specifics. Prior art model-driven generators produce partial sections of new code or Meta Data, such as documentation, profile information, or complete code implementations. In each case, the output code is compiled with a framework compatible with an underlying technology platform and/or operating system.
The input to the model-driven source code generators is an interconnected group of abstract representations (i.e. a model) which declares what is required rather than statements of how things should be implemented. Each element in the model representation corresponds to an element or concept in the problem area (domain). Models are attractive because they allow a problem to be precisely described in a way that avoids technological detail. They allow the problem to be described using terms and concepts that are familiar to workers in the domain, rather than only in languages specific to software developers. Consequently, the model helps bridge the gap between customers and technology providers.
Models range from simple abstractions to models based on general purpose domain languages such as UML (Unified Modeling Language), through to the definition and use of Domain Specific Languages (DSLs). Models may take a diagrammatic and/or textual form. The underlying model concepts or elements are usually implemented via the use of interlocking object orientated components and/or patterns. Many model-driven source code generators commercially available today are based on the MDA-OMG (Model Driven Architecture by the Object Management Group) standard. This standard is based on models specified in UML with an initial platform-independent model being transformed into a platform-specific model which in turn is used to generate final code.
Model-driven generators are generally regarded as being better than code-driven source code generators for general applications. Model-driven source code generators provide high levels of design abstraction. This results in higher productivity gains for programming design teams. Furthermore, since the modeling input is not code specific, the input model can be platform-independent.
However, model-driven source code generators do have certain disadvantages. For instance, if model-driven source code generators are being used to design an application from scratch, the entire problem domain must be modeled. For new problems, this can be a difficult task. Generalizing the whole of a problem domain can be difficult and becomes more difficult still as the domain becomes wider and/or the level of abstraction higher. Implicitly, the problem domain must be fully understood. Often this occurs only after working code has been produced which is satisfactory to the customer. In many cases, producing the model can be more difficult than just manually producing the required source code. Furthermore, even where the problem domain is understood, it has been found that it can be very difficult to fully capture it in many cases due to the difficulties using generalized model constructs and concepts such as provided by UML, to express many real world concepts, activities and objects. In current practice, code generation is most often applied to well defined domains which can be readily formalized such as database access or user interface design. For complete applications, it is often still necessary to hand write a broad spectrum of code. Accordingly, full code generation is more successful when both the modeling language and the generator are very domain specific.
Even with such preparations, aspects of the solution, such as error handling, security, transaction control, concurrent access, remoting, debugging, etc. can be difficult to express in a cleanly localized way. And these problems increase as the problem domain becomes wider. Consequently, the development process usually ends up with a fragmentation problem; many small sections of code fragments are required in multiple places.
Additionally, applying model-drive source code generation to existing code bases is very difficult. This is due to the need for existing code to fit with the underlying modeling constructs and concepts. E.g. particular arrangements of object orientated programming. Extensive code modifications must typically be made in order to produce a framework of code templates to match the chosen modeling design system.
A recent approach aimed at countering the many outstanding issues with code generation systems is “generative programming”. Relative to code generation, this approach promises to provide a standardized approach to capturing the problem domain via a process of “domain engineering”. In domain engineering, problem domains are captured at a very high level of abstraction via a complex process of context analysis and modeling, in order to produce DSLs (Domain Specific Languages). A significant component of domain engineering is “feature modeling”, which is used in order to overcome the inflexibility of generalized modeling languages such as UML. Feature modeling involves the activity of modeling the common and the variable properties of concepts and their interdependencies and organizing them into a coherent model. This helps limit modeling problems in the area of fragmentation. However, the problem of application to existing code bases remains as does the effort involved in the initial modeling process. Furthermore such systems operate with the implicit assumption that it is possible to capture the problem domain at the outset. In practice this is as much a business process issue as it is a technical issue.
U.S. Pat. No. 6,560,771 to Yotsukura, entitled System And Method For Reusing A Classed Method In Object Oriented Programming, discloses a system capable of being used on existing code provided said code is already fully object orientated. The system requires the user to be involved at the level of designing code classes based on existing classes and does not provide higher levels of design abstraction. It furthermore does not offer a solution to the fragmentation or domain modeling problems described above. U.S. Patent Application Publication No. 2006/0015856 to Lotter, entitled Modification Method For Modifying A Source Code, discloses a system where potential modification locations of the source code to be modified are pre-defined by means of comment markers placed in the source code. An input panel is used to provide modification data for each comment marker location. However, there is no input abstraction provided and no separation between the implementation and the input design modification. Also, the same design modification cannot be readily applied across different platforms. Furthermore, it requires an input panel entry for each comment entry thus making the process cumbersome for the user.
U.S. Pat. No. 5,448,740 to Kiri, entitled Generation Of A User Interface Code From A Corresponding Declarative Language Program, discloses a system where the modeling relates to the limited domain of user interfaces only and cannot be applied to existing code.
U.S. Pat. No. 6,093,215 to Buxton, entitled Method And Apparatus For Building Templates In A Component System, discloses a system for creating and distributing customized applications based on the modification of object orientated components via a template builder. This system can be applied to existing binary components rather than source code, provided they are fully object orientated with each object having a class definition and defined methods. Additionally each platform must have a run-time mechanism for executing the ‘distribution packs’ of components. There are, consequently, limitations placed on both existing applications and the platforms on which they run.
U.S. Pat. No. 6,876,314 to Lin, entitled Self-Generating Automatic Code Generator, discloses a system for producing code generators that avoid the issue of manual maintenance of generated code. A self-generating automatic code generator is described that maintains continuity with enterprise applications throughout development and maintenance of the applications. If a new feature is required by one application that would also be needed by the other applications within the organization, a programmer may add this new feature to the self-generating automatic code generator. However, it cannot be used on existing source code that has not been previously generated using the system. It requires explicit capturing and storing of the set of knowledge and rules the define the application and does not offer a solution to the fragmentation or domain modeling problems.
U.S. Pat. No. 6,408,431 to Heughebaert, entitled Method And Apparatus For Multiple Language Software Code Generation, discloses a system where generic multi-language code generation is created. Although the system is not platform dependent, the system requires a full model (input specification) of the features of the application to be generated. Accordingly, the system has the domain modeling problems of other prior art systems as well as the fragmentation problems associated with such a modeling technique. It also cannot be applied to existing code. U.S. Pat. No. 6,011,917 to Leymann, entitled Method and Computer system for generating Process Management Programs from Process Models, shows a model-based code generating system utilising a modeling language (FDL). However, the modeling provides low-levels of abstraction requiring the user to be involved in some aspects of implementation coding. The system is further limited to the domain of process management programs and cannot be applied to existing code.
U.S. Pat. No. 6,370,681 to Dellarocas, entitled Computer System And Computer Implementated Process For Representing Software System, shows a model-based code generating system that utilizes component building blocks in an attempt to solve problems of fragmentation. However, the system still requires a full model of the application domain. Accordingly, the system has the same domain modeling problems as other prior art systems. It also cannot be applied to existing source code unless the existing code is based on compatible software components.
The issues described above with the prior-art code generation systems currently lead many organizations to avoid the use of model-driven code generation. Code-driven generation can lead to some improvements in development time and costs. However, many organizations and software engineers regard the modest improvements as being outweighed by learning curve and maintenance issues.
A need therefore exists for a code generation method capable of being applied to existing source code which has the productivity and abstracted input advantages of model-driven code generation systems whilst reducing or avoiding the domain modeling and fragmentation problems. This need is met by the present invention as described and claimed below.